/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sampleEntity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author ASUS K43E
 */
@Entity
@Table(name = "Customers", catalog = "Lafitte", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Customers.findAll", query = "SELECT c FROM Customers c"),
    @NamedQuery(name = "Customers.findByUsername", query = "SELECT c FROM Customers c WHERE c.username = :username"),
    @NamedQuery(name = "Customers.findById", query = "SELECT c FROM Customers c WHERE c.id = :id"),
    @NamedQuery(name = "Customers.findByDateOfBirth", query = "SELECT c FROM Customers c WHERE c.dateOfBirth = :dateOfBirth"),
    @NamedQuery(name = "Customers.findByCardId", query = "SELECT c FROM Customers c WHERE c.cardId = :cardId"),
    @NamedQuery(name = "Customers.findByGender", query = "SELECT c FROM Customers c WHERE c.gender = :gender"),
    @NamedQuery(name = "Customers.findByBankAccount", query = "SELECT c FROM Customers c WHERE c.bankAccount = :bankAccount"),
    @NamedQuery(name = "Customers.findByBankName", query = "SELECT c FROM Customers c WHERE c.bankName = :bankName"),
    @NamedQuery(name = "Customers.findByPoint", query = "SELECT c FROM Customers c WHERE c.point = :point"),
    @NamedQuery(name = "Customers.findByRank", query = "SELECT c FROM Customers c WHERE c.rank = :rank"),
    @NamedQuery(name = "Customers.findByJob", query = "SELECT c FROM Customers c WHERE c.job = :job"),
    @NamedQuery(name = "Customers.findByIsBlock", query = "SELECT c FROM Customers c WHERE c.isBlock = :isBlock"),
    @NamedQuery(name = "Customers.findByIsLost", query = "SELECT c FROM Customers c WHERE c.isLost = :isLost")})
public class Customers implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "username", nullable = false, length = 30)
    private String username;
    @Basic(optional = false)
    @Column(name = "Id", nullable = false, length = 50)
    private String id;
    @Basic(optional = false)
    @Column(name = "dateOfBirth", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateOfBirth;
    @Column(name = "cardId", length = 30)
    private String cardId;
    @Basic(optional = false)
    @Column(name = "gender", nullable = false, length = 10)
    private String gender;
    @Basic(optional = false)
    @Column(name = "bankAccount", nullable = false, length = 17)
    private String bankAccount;
    @Basic(optional = false)
    @Column(name = "bankName", nullable = false, length = 50)
    private String bankName;
    @Basic(optional = false)
    @Column(name = "point", nullable = false)
    private int point;
    @Basic(optional = false)
    @Column(name = "rank", nullable = false, length = 7)
    private String rank;
    @Column(name = "job", length = 150)
    private String job;
    @Basic(optional = false)
    @Column(name = "isBlock", nullable = false)
    private boolean isBlock;
    @Basic(optional = false)
    @Column(name = "isLost", nullable = false)
    private boolean isLost;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customers")
    private Collection<Bill> billCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "customers")
    private Collection<BookRoom> bookRoomCollection;
    @JoinColumn(name = "username", referencedColumnName = "username", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Account account;

    public Customers() {
    }

    public Customers(String username) {
        this.username = username;
    }

    public Customers(String username, String id, Date dateOfBirth, String gender, String bankAccount, String bankName, int point, String rank, boolean isBlock, boolean isLost) {
        this.username = username;
        this.id = id;
        this.dateOfBirth = dateOfBirth;
        this.gender = gender;
        this.bankAccount = bankAccount;
        this.bankName = bankName;
        this.point = point;
        this.rank = rank;
        this.isBlock = isBlock;
        this.isLost = isLost;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Date getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(Date dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getBankAccount() {
        return bankAccount;
    }

    public void setBankAccount(String bankAccount) {
        this.bankAccount = bankAccount;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public String getRank() {
        return rank;
    }

    public void setRank(String rank) {
        this.rank = rank;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public boolean getIsBlock() {
        return isBlock;
    }

    public void setIsBlock(boolean isBlock) {
        this.isBlock = isBlock;
    }

    public boolean getIsLost() {
        return isLost;
    }

    public void setIsLost(boolean isLost) {
        this.isLost = isLost;
    }

    public Collection<Bill> getBillCollection() {
        return billCollection;
    }

    public void setBillCollection(Collection<Bill> billCollection) {
        this.billCollection = billCollection;
    }

    public Collection<BookRoom> getBookRoomCollection() {
        return bookRoomCollection;
    }

    public void setBookRoomCollection(Collection<BookRoom> bookRoomCollection) {
        this.bookRoomCollection = bookRoomCollection;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (username != null ? username.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Customers)) {
            return false;
        }
        Customers other = (Customers) object;
        if ((this.username == null && other.username != null) || (this.username != null && !this.username.equals(other.username))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sampleEntity.Customers[username=" + username + "]";
    }

}
